package com.tptech.nearme.rest;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Properties;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.tptech.nearme.data.LocationRepository;
import com.tptech.nearme.data.UserRepository;
import com.tptech.nearme.helper.GeocodeAction;
import com.tptech.nearme.model.Location;
import com.tptech.nearme.model.NearmeLocation;
import com.tptech.nearme.model.User;


public class LocationResource {
	private List<NearmeLocation> locationList=new ArrayList<NearmeLocation>();
	
	
	public LocationResource(List<? extends NearmeLocation> location) {
		if(location==null || location.size()<=0){
			locationList = Collections.EMPTY_LIST;
			return;
		}
		locationList = new ArrayList<NearmeLocation>(location.size());
		locationList.addAll(location);
	}
	
	public LocationResource(NearmeLocation location){
		if(location==null){
			locationList=Collections.EMPTY_LIST;
			return;
		}
		locationList = new ArrayList<NearmeLocation>(1);
		locationList.add(location);
	}
	
	@GET
	@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
	public Response listAll(){
		return Response.ok(locationList).build();
	}
}
